<!DOCTYPE HTML>
<html>
<head>
    <title>Getting Started: Serving Web Content</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="./layui/css/layui.css"  media="all">
    <style type="text/css">
        .center {
            position: fixed;
            top: 50%;
            left: 50%;
            width:50%;
            height: 50%;
            -webkit-transform: translateX(-50%) translateY(-50%);
            -webkit-transform: translateX(-50%) translateY(-50%);
            -moz-transform: translateX(-50%) translateY(-50%);
            -ms-transform: translateX(-50%) translateY(-50%);
            transform: translateX(-50%) translateY(-50%);
        }
    </style>
</head>
<body>
<div>
    <ul class="layui-nav">
    </ul>
</div>
<div class="layui-upload-drag center" id="uploadfile" style="margin: auto;">
    <div class="center">
        <p>点击上传，或将文件拖拽到此处</p>
    </div>
</div>

<script src="./layui/layui.js" charset="utf-8"></script>
<script src="./js/mainmenu.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['upload','layer'], function(){
        var $ = layui.jquery
            ,upload = layui.upload
            ,layer = layui.layer;

        //拖拽上传
        upload.render({
            elem: '#uploadfile'
            ,url: '/box/excelImportLineup'
            ,field: 'uploadfile'
            ,accept: 'file'
            ,headers:{ token: window.sessionStorage.getItem('token') }
            ,exts: 'xls|xlsx'
            ,done: function(data){
                if (data.code == 0) {
                    parent.location.reload()
                }else{
                    layer.msg("异常错误:"+data.message)
                }
            }
            ,error:function (index) {
                console.log(index)
            }
        });

    });
</script>

</body>
</html>
